<?php
class Nadeb_Form_Textarea
{
	private $param;
	private $label;
	
	private $inputTag;
	private $tag = "";
	
	public function __construct($_param)
	{
		$this->label   = $_param["label"];
		$this->value   = '';
		$this->param   = $_param;
		
		unset($this->param["rules"]);
		unset($this->param["label"]);
		unset($this->param["type"]);
		
		if( isset($_param["value"]) )
		{
			$this->value = $_param["value"];
			unset($this->param["value"]);
		}
	}
	
	public function create_object()
	{
		/*
		 * input TAG
		 */
		$this->inputTag = "<textarea";
		foreach($this->param as $key => $value)
		{
			if( $key == "name" || $key == "value")
				$this->inputTag .= ' ' . $key . '="' . $value . '"';
			else
				$this->inputTag .= ' ' . $key . '="' . strtolower($value) . '"';
		}
		$this->inputTag .= ">";
		
		if($this->value) 
			$this->inputTag .= $this->value;
			
		$this->inputTag .= "</textarea>";
		
		
		/*
		 * dt TAG
		 */
		$this->tag .= "
		<dt id=\"{$this->param["id"]}-label\">
			<label for=\"".strtolower($this->param["name"])."\" class=\"{$this->param["name"]}-label\">{$this->label}</label>
		</dt>";

		
		/*
		 * dd TAG
		 */
		$this->tag .= "
		<dd id=\"{$this->param["id"]}-object\">
			$this->inputTag
		</dd>";
	}
	
	public function get_xhtml()
	{
		return $this->tag;
	}
}




